package cn.wolfcode.wolf2w.controller;

import cn.wolfcode.wolf2w.domain.Destination;
import cn.wolfcode.wolf2w.domain.Region;
import cn.wolfcode.wolf2w.domain.StrategyCatalog;
import cn.wolfcode.wolf2w.domain.Travel;
import cn.wolfcode.wolf2w.service.*;
import cn.wolfcode.wolf2w.util.JsonResult;
import jdk.nashorn.internal.objects.annotations.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/destinations")
public class DestinationController {
    @Autowired
    private IRegionService regionService;
    @Autowired
    private IDestinationService destinationService;
    @Autowired
    private IStrategyCatalogService strategyCatalogService;
    @Autowired
    private IStrategyService strategyService;
    @Autowired
    private ITravelService travelService;

    @GetMapping("/hotRegion")
    public Object hotRegion(){
        //List<Region> list = regionService.queryHotRegion();
        return JsonResult.success(regionService.queryHotRegion());
    }
    //查找区域下的目的地
    @GetMapping("/search")
    public Object search(String regionId){
        return  JsonResult.success(destinationService.queryDestByRegionIdForApi(regionId));
    }
    //目的地吐司
    @GetMapping("/toasts")
    public Object toasts(String destId){
        List<Destination> list = destinationService.findtoasts(destId);
        System.err.println(list);
        return  JsonResult.success(list);
    }
    //概况
    @GetMapping("/catalogs")
    public Object detail(String destId){
        List<StrategyCatalog> strategyCatalogs = strategyCatalogService.queryCatalogByDestinationId(destId);
        System.out.println(strategyCatalogs);
        return  JsonResult.success(strategyCatalogs);
    }
    @GetMapping("/strategies/viewnumTop3")
    public Object viewnumTop3(String destId){
        return  JsonResult.success(strategyService.queryviewnumTop3(destId));
    }
    @GetMapping("/travels/viewnumTop3")
    public Object TravelTop3(String destId){
        return  JsonResult.success(travelService.viewnumTop3(destId));
    }

}
